class Solution {
    public int hIndex(int[] citations) {
        Arrays.sort(citations);
        int heigth = 0;
        int l = citations.length-1;
        while(l >= 0 && citations[l] > heigth) {
            heigth++;
            l--;
        }
        return heigth;
    }
}